package com.antsoldier.controller;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.antsoldier.model.User;


@RestController
public class UserConsumerController {
	
	@Resource
	private RestTemplate restTemplate;
	
	@Value("${userServicePath}")
	private String userServicePath;
	
	@GetMapping(value="/userConsumer/{id}")
	public User findById(@PathVariable Long id){
		return restTemplate.getForObject(userServicePath + "/user/findById/"+id, User.class);
	}
}
